﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Remoting;
using com.eforceglobal.crux.configuration;

namespace com.eforceglobal.crux.security
{
    public class CruxSecurityManagerFactory
    {
        public static ICruxSecurityManager  GetSecurityManager()
        {
            string DLLClassInformation = CruxConfigurationManager.GetClassDetailsForSecurityManager("CruxSecurityProvider");
            string[] DllClassDetails = DLLClassInformation.Split(',');
            string ClassDetails = DllClassDetails[0].Trim();
            string DllDetails = DllClassDetails[1].Trim();

            ObjectHandle objectHandle = Activator.CreateInstance(DllDetails, ClassDetails);
            ICruxSecurityManager securityManager = (ICruxSecurityManager)objectHandle.Unwrap();
            return securityManager;
        }
    }
}
